package cn.tedu.api;

import java.math.BigDecimal;
import java.util.Scanner;

//测试 小数运算精确的解决方案
public class Test4_BigDecimal {
    public static void main(String[] args) {
        method();
    }

    public static void method(){
        double a = new Scanner(System.in).nextDouble();
        double b = new Scanner(System.in).nextDouble();

        BigDecimal bigDecimal = new BigDecimal(String.valueOf(a));
        BigDecimal bigDecimal2 = new BigDecimal(String.valueOf(b));

        System.out.println(bigDecimal.add(bigDecimal2));
        System.out.println(bigDecimal.subtract(bigDecimal2));
        System.out.println(bigDecimal.multiply(bigDecimal2));
        System.out.println(bigDecimal.divide(bigDecimal2,5,BigDecimal.ROUND_HALF_UP));

    }
}

